using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace RA_WebSite.Models.Mapping
{
    public class StepMap : EntityTypeConfiguration<Step>
    {
        public StepMap()
        {
            this.HasKey(t => t.Id);

            this.ToTable("Step");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.DataCaricamento).HasColumnName("DataCaricamento");
            this.Property(t => t.OreDiEsecuzione).HasColumnName("OreDiEsecuzione");
            this.Property(t => t.Campione_Id).HasColumnName("Campione_Id");

            this.HasOptional(t => t.Campione)
                .WithMany(t => t.Steps)
                .HasForeignKey(d => d.Campione_Id)
                .WillCascadeOnDelete(true);

        }
    }
}
